export default {
	data() {
		return {
			tabs: ['余额明细', '积分明细'],
			current: 0,
			list: [],
			limit: 10,
			userInfo: {},
			noticeText: '公告公告你公安共'
		};
	},
	onLoad(options) {
		this.current = Number(options.index) || 0
		this.getUserInfo()
	},
	methods: {
		// 获取个人信息
		async getUserInfo() {
			var res = await this.$get('server/login/loaduser');
			if (res.errcode != 0) {
				this.$toast(res.errmsg);
				return;
			}
			this.userInfo = res.data.user
		},
		// 获取列表
		async getList(pageNo, pageSize) {
			var res = await this.$get('server/index/getcoinlist', {
				page: pageNo,
				limit: pageSize,
				type: '', //1收入 2支出
				bizhong: this.current + 1 // 1 余额 2 积分
			});
			if (res.errcode != 0) {
				this.$toast(res.errmsg);
				this.$refs.paging.complete(false);
				return;
			}
			this.$refs.paging.complete(res.list);
		},
		changeTab(index) {
			this.current = index
			this.$refs.paging.reload();
		}
	}
};
